package com.imooc;

public class Hello {
	
		String name;
		String sex;
		static int age;
		
		public String getName() {
			return name;
		}
		public void setName(String name) {
			this.name = name;
		}
		public String getSex() {
			return sex;
		}
		public void setSex(String sex) {
			this.sex = sex;
		}
		public static int getAge() {
			return age;
		}
		public static void setAge(int age) {
			Hello.age = age;
		}
		public Hello(){
			System.out.println("通过构造方法初始化name");
			name = "tome";
		}
		
		{
			System.out.println("通过初始化块初始化sex");
			sex = "男";
		}
		
		static {
			System.out.println("通过静态初始化块初始化age");
			age  = 20;
		}
		
		public void show(){
			System.out.println("name:" + name + ",sex:" + sex + ",age:" + age);
		}
		public static void main(String[] args) {
			Hello hello = new Hello();
			hello.show();
	}
}
